import request from '@/utils/request'

const RESOURCE_URL = 'system/permissions'

export function getPermissionList(params) {
  return request({
    url: RESOURCE_URL,
    method: 'get',
    params
  })
}

export function getPermissionTree() {
  return request({
    url: RESOURCE_URL + '/tree',
    method: 'get'
  })
}

export function createPermission(data) {
  return request({
    url: RESOURCE_URL,
    method: 'post',
    data
  })
}

export function updatePermission(data) {
  return request({
    url: RESOURCE_URL + '/' + data.id,
    method: 'put',
    data
  })
}

export function destroyPermission(data) {
  return request({
    url: RESOURCE_URL + '/' + data.id,
    method: 'delete',
    data
  })
}
